package com.wu.framework.upms.controller;

import com.wu.framework.oauth.api.OAuth2Api;
import com.wu.framework.upms.domain.qo.UserLoginQo;
import com.wu.framework.inner.layer.web.EasyController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * description
 *
 * @author 吴佳伟
 * @date 2021/5/25 3:40 下午
 */
@Api(tags = "用户操作")
@EasyController("/user")
public class UserController {


    private final OAuth2Api oAuth2Api;

    public UserController(OAuth2Api oAuth2Api) {
        this.oAuth2Api = oAuth2Api;
    }

    /**
     * description
     * @param
     * @return
     * @exception/throws
     * @author 吴佳伟
     * @date 2021/5/27 4:06 下午
     */
    @ApiOperation(tags = "用户操作", value = "web端用户登陆")
    @PostMapping("/login")
    public Object login(@RequestBody UserLoginQo userLoginQo) {
        return oAuth2Api.getToken(userLoginQo.getTenantId(),
                "password",userLoginQo.getUsername(),
                userLoginQo.getPassword(),
                "web","uaa","uaa");
    }


}
